package cn.lg.soar.generator.model;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
public class JavaFieldConfig {

    @ApiModelProperty("数据库字段名")
    private String name;

    @ApiModelProperty("属性名")
    private String propertyName;

    @ApiModelProperty("数据类型")
    private String javaType;

    @ApiModelProperty("描述")
    private String comment;

    @ApiModelProperty("是否主键字段")
    private boolean pk;

    @ApiModelProperty(value = "可为空")
    private boolean nullable;

    @ApiModelProperty(value = "注解")
    private List<String> annotations;

    @ApiModelProperty(value = "启用")
    private boolean enabled;

    public void addAnnotation(String annotation) {
        if (annotations == null) {
            annotations = new ArrayList<>();
        }
        annotations.add(annotation);
    }

}
